<?php
/**
 * Created by JetBrains PhpStorm.
 * User: cky
 * Date: 3/13/11
 * Time: 7:30 PM
 * To change this template use File | Settings | File Templates.
 */
 
class Controller_Main extends \Controller_Base
{
    public function before()
    {
        parent::before();
    }

    public function action_index()
    {
        $total_posts = Model_Post::count();

        Pagination::set_config(array(
            'pagination_url' => 'main/index',
            'per_page' => 5,
            'total_items' => $total_posts,
            'num_links' => 3,
        ));

        $posts = Model_Post::get_latest(Pagination::$per_page, Pagination::$offset)->execute();

        $this->template->title = 'Welcome';
        $this->template->total_posts = $total_posts;
        $this->template->posts = $posts;
    }


    public function action_files()
    {
        $this->template->title = 'Files';
    }

    public function action_status()
    {
        $this->template->status = 'Status';
    }
}